package com.smec.remes.util;

import android.app.Dialog;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.smec.moblie.R;
import com.smec.moblie.databinding.DialogRemarkBinding;

/**
 * Created by xupeizuo on 2018/5/9.
 */

public class RemarkDialog extends Dialog {

    private DialogRemarkBinding dialogRemarkBinding;
    private Dialoglistener listener;

    public RemarkDialog(Context context,int themeResId,Dialoglistener dialoglistener) {
        super(context, themeResId);
        this.setCanceledOnTouchOutside(false);
        this.listener=dialoglistener;
        dialogRemarkBinding=DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_remark,null,false);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(dialogRemarkBinding.getRoot());
        dialogRemarkBinding.reMakeSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.makeSure(dialogRemarkBinding.reRemark.getText().toString(),RemarkDialog.this);
            }
        });
        dialogRemarkBinding.reCancle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.cancle(RemarkDialog.this);
            }
        });
    }

  public   interface Dialoglistener{
        void cancle(RemarkDialog dialog);
        void makeSure(String remark,RemarkDialog dialog);
    }
}
